home *** CD-ROM | disk | FTP | other *** search
/ One Click 27 / CD da revista One Click #27 - Photoshop Megapack (2005).iso / Interface / it.dig / scripts / __Packages / mx / controls / RadioButton.as < prev    next >
Encoding:
Text File  |  2005-10-28  |  6.2 KB  |  230 lines

  1. class mx.controls.RadioButton extends mx.controls.Button
  2. {
  3.    var __value;
  4.    var dispatchEvent;
  5.    var __data;
  6.    static var symbolName = "RadioButton";
  7.    static var symbolOwner = mx.controls.RadioButton;
  8.    static var version = "2.0.1.78";
  9.    var className = "RadioButton";
  10.    var btnOffset = 0;
  11.    var __toggle = true;
  12.    var __label = "Radio Button";
  13.    var __labelPlacement = "right";
  14.    var ignoreClassStyleDeclaration = {Button:1};
  15.    var __groupName = "radioGroup";
  16.    var indexNumber = 0;
  17.    var offset = false;
  18.    var falseUpSkin = "";
  19.    var falseDownSkin = "";
  20.    var falseOverSkin = "";
  21.    var falseDisabledSkin = "";
  22.    var trueUpSkin = "";
  23.    var trueDownSkin = "";
  24.    var trueOverSkin = "";
  25.    var trueDisabledSkin = "";
  26.    var falseUpIcon = "RadioFalseUp";
  27.    var falseDownIcon = "RadioFalseDown";
  28.    var falseOverIcon = "RadioFalseOver";
  29.    var falseDisabledIcon = "RadioFalseDisabled";
  30.    var trueUpIcon = "RadioTrueUp";
  31.    var trueDownIcon = "";
  32.    var trueOverIcon = "";
  33.    var trueDisabledIcon = "RadioTrueDisabled";
  34.    var centerContent = false;
  35.    var borderW = 0;
  36.    var clipParameters = {labelPlacement:1,data:1,label:1,groupName:1,selected:1};
  37.    static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.RadioButton.prototype.clipParameters,mx.controls.Button.prototype.clipParameters);
  38.    function RadioButton()
  39.    {
  40.       super();
  41.    }
  42.    function init(Void)
  43.    {
  44.       this.setToggle(this.__toggle);
  45.       this.__value = this;
  46.       super.init();
  47.    }
  48.    function size(Void)
  49.    {
  50.       super.size();
  51.    }
  52.    function onRelease()
  53.    {
  54.       if(this.selected)
  55.       {
  56.          return undefined;
  57.       }
  58.       this.releaseFocus();
  59.       this.phase = "up";
  60.       this.setSelected(true);
  61.       this.dispatchEvent({type:"click"});
  62.       this._parent[this.__groupName].dispatchEvent({type:"click"});
  63.    }
  64.    function setData(val)
  65.    {
  66.       this.__data = val;
  67.    }
  68.    function set data(val)
  69.    {
  70.       this.__data = val;
  71.    }
  72.    function getData(val)
  73.    {
  74.       return this.__data;
  75.    }
  76.    function get data()
  77.    {
  78.       return this.__data;
  79.    }
  80.    function onUnload()
  81.    {
  82.       if(this._parent[this.__groupName].selectedRadio == this)
  83.       {
  84.          this._parent[this.__groupName].selectedRadio = undefined;
  85.       }
  86.       this._parent[this.__groupName].radioList[this.indexNumber] = null;
  87.       delete this._parent[this.__groupName].radioList[this.indexNumber];
  88.    }
  89.    function setSelected(val)
  90.    {
  91.       var _loc2_ = this._parent[this.__groupName];
  92.       var _loc4_ = _loc2_.selectedRadio.__width;
  93.       var _loc5_ = _loc2_.selectedRadio.__height;
  94.       if(val)
  95.       {
  96.          _loc2_.selectedRadio.setState(false);
  97.          _loc2_.selectedRadio = this;
  98.       }
  99.       else if(_loc2_.selectedRadio == this)
  100.       {
  101.          _loc2_.selectedRadio.setState(false);
  102.          _loc2_.selectedRadio = undefined;
  103.       }
  104.       this.setState(val);
  105.    }
  106.    function deleteGroupObj(groupName)
  107.    {
  108.       delete this._parent[groupName];
  109.    }
  110.    function getGroupName()
  111.    {
  112.       return this.__groupName;
  113.    }
  114.    function get groupName()
  115.    {
  116.       return this.__groupName;
  117.    }
  118.    function setGroupName(groupName)
  119.    {
  120.       if(groupName == undefined || groupName == "")
  121.       {
  122.          return undefined;
  123.       }
  124.       delete this._parent[this.__groupName].radioList[this.__data];
  125.       this.addToGroup(groupName);
  126.       this.__groupName = groupName;
  127.    }
  128.    function set groupName(groupName)
  129.    {
  130.       this.setGroupName(groupName);
  131.    }
  132.    function addToGroup(groupName)
  133.    {
  134.       if(groupName == "" || groupName == undefined)
  135.       {
  136.          return undefined;
  137.       }
  138.       var _loc2_ = this._parent[groupName];
  139.       if(_loc2_ == undefined)
  140.       {
  141.          var _loc0_ = null;
  142.          _loc2_ = this._parent[groupName] = new mx.controls.RadioButtonGroup();
  143.          _loc2_.__groupName = groupName;
  144.       }
  145.       _loc2_.addInstance(this);
  146.       if(this.__state)
  147.       {
  148.          _loc2_.selectedRadio.setState(false);
  149.          _loc2_.selectedRadio = this;
  150.       }
  151.    }
  152.    function get emphasized()
  153.    {
  154.       return undefined;
  155.    }
  156.    function keyDown(e)
  157.    {
  158.       switch(e.code)
  159.       {
  160.          case 40:
  161.             this.setNext();
  162.             break;
  163.          case 38:
  164.             this.setPrev();
  165.             break;
  166.          case 37:
  167.             this.setPrev();
  168.             break;
  169.          case 39:
  170.             this.setNext();
  171.       }
  172.    }
  173.    function setNext()
  174.    {
  175.       var _loc2_ = this._parent[this.groupName];
  176.       if(_loc2_.selectedRadio.indexNumber + 1 == _loc2_.radioList.length)
  177.       {
  178.          return undefined;
  179.       }
  180.       var _loc4_ = !_loc2_.selectedRadio ? -1 : _loc2_.selectedRadio.indexNumber;
  181.       var _loc3_ = 1;
  182.       while(_loc3_ < _loc2_.radioList.length)
  183.       {
  184.          if(_loc2_.radioList[_loc4_ + _loc3_] != undefined && _loc2_.radioList[_loc4_ + _loc3_].enabled)
  185.          {
  186.             var _loc5_ = this.getFocusManager();
  187.             _loc2_.radioList[_loc4_ + _loc3_].selected = true;
  188.             _loc5_.setFocus(_loc2_.radioList[_loc2_.selectedRadio.indexNumber]);
  189.             _loc2_.dispatchEvent({type:"click"});
  190.             break;
  191.          }
  192.          _loc3_ = _loc3_ + 1;
  193.       }
  194.    }
  195.    function setPrev()
  196.    {
  197.       var _loc2_ = this._parent[this.groupName];
  198.       if(_loc2_.selectedRadio.indexNumber == 0)
  199.       {
  200.          return undefined;
  201.       }
  202.       var _loc4_ = !_loc2_.selectedRadio ? 1 : _loc2_.selectedRadio.indexNumber;
  203.       var _loc3_ = 1;
  204.       while(_loc3_ < _loc2_.radioList.length)
  205.       {
  206.          if(_loc2_.radioList[_loc4_ - _loc3_] != undefined && _loc2_.radioList[_loc4_ - _loc3_].enabled)
  207.          {
  208.             var _loc5_ = this.getFocusManager();
  209.             _loc2_.radioList[_loc4_ - _loc3_].selected = true;
  210.             _loc5_.setFocus(_loc2_.radioList[_loc2_.selectedRadio.indexNumber]);
  211.             _loc2_.dispatchEvent({type:"click"});
  212.             break;
  213.          }
  214.          _loc3_ = _loc3_ + 1;
  215.       }
  216.    }
  217.    function set toggle(v)
  218.    {
  219.    }
  220.    function get toggle()
  221.    {
  222.    }
  223.    function set icon(v)
  224.    {
  225.    }
  226.    function get icon()
  227.    {
  228.    }
  229. }
  230.